package com.fmi.thirdsdk.jpush;

import android.text.TextUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by ZeroVoid on 2018-3-12.
 */

public class JPushUtil {
    // 校验Tag Alias 只能是数字,英文字母和中文
    public static String isValidTagAndAlias(String s) {
        if (TextUtils.isEmpty(s)) {
            return null;
        }
        s = s.replaceAll("-", "#");
        Pattern p = Pattern.compile("^[\u4E00-\u9FA50-9a-zA-Z_!@#$&*+=.|]+$");
        Matcher m = p.matcher(s);
        boolean isOk = m.matches();
        if (isOk) {
            return s;
        }
        return null;
    }
}
